package org.community.detail.service.media.picture;


import org.community.detail.config.MultiPartConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(
        value = "community-picture-service",
        configuration = MultiPartConfig.class
)
@Service
public interface PortraitService {

    @PostMapping(value = "/portrait/{userId}",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    ResponseEntity<byte[]> portraitUpload(@PathVariable("userId") Integer userId, MultipartFile file);

    @GetMapping("/portrait/{userId}")
    ResponseEntity<byte[]>  portraitDownload(@PathVariable("userId") Integer userId);
}
